﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;

namespace QuanLyHocBongSinhVien.DAO
{
 class LoaiHocBong_DAO
    {
     dbConnection db = new dbConnection();

     public DataTable getAllLoaiHB()
     {
         return db.ExecuteQuery("select * from LOAIHOCBONG");
     }

     public DataTable getMaHB()
     {
         string sql = "select MAHB,TENHB from LOAIHOCBONG";
         return db.ExecuteQuery(sql);
     }
     public void themLHB(string M, string T, string N, string G, int C)
     {
         SqlParameter[] mang = new SqlParameter[5];
         mang[0] = new SqlParameter("@mahb", M);
         mang[1] = new SqlParameter("@tenhb", T);
         mang[2] = new SqlParameter("@nhataitro", N);
         mang[3] = new SqlParameter("@ghichu", G);
         mang[4] = new SqlParameter("@chitieu", C);
         db.ExecuteNonQuery("ThemLoaiHocBong",mang);
     }

     public void suaLHB(string M, string T, string N, string G, int C)
     {
         SqlParameter[] mang = new SqlParameter[5];
         mang[0] = new SqlParameter("@mahb", M);
         mang[1] = new SqlParameter("@tenhb", T);
         mang[2] = new SqlParameter("@nhataitro", N);
         mang[3] = new SqlParameter("@ghichu", G);
         mang[4] = new SqlParameter("@chitieu", C);
         db.ExecuteNonQuery("SuaLoaiHocBong", mang);
     }

     public void xoaLHB(string M)
     {
         SqlParameter[] mang = new SqlParameter[1];
         mang[0] = new SqlParameter("@mahb", M);
         db.ExecuteNonQuery("Xoa_LoaiHocBong", mang);
     }

     public void timkiemLHB(string M)
     {
         SqlParameter[] mang = new SqlParameter[1];
         mang[0] = new SqlParameter("@mahb", M);
         db.ExecuteNonQuery("TimKiem_LoaiHocBong", mang);
     }
     public void timkiemTenLHB(string M)
     {
         SqlParameter[] mang = new SqlParameter[1];
         mang[0] = new SqlParameter("@tenhb", M);
         db.ExecuteNonQuery(" TimKiem_TenLoaiHocBong", mang);
     }

     public void timkiemTenNTT(string M)
     {
         SqlParameter[] mang = new SqlParameter[1];
         mang[0] = new SqlParameter("@nhataitro ", M);
         db.ExecuteNonQuery("TimKiem_NTTLoaiHocBong", mang);
     }
     public void timkiemCT(int M)
     {
         SqlParameter[] mang = new SqlParameter[1];
         mang[0] = new SqlParameter("@chitieu ", M);
         db.ExecuteNonQuery("TimKiem_CTieuLoaiHocBong", mang);
     }
    
    }
}
